home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- //
- // Creation Date: April 1, 2001
- //
- //
- // Procedure Name:
- // AEbevelPlusTemplate
- //
- // Description Name;
- // Creates the attribute editor controls for the bevel plus node
- //
- // Input Value:
- // nodeName
- //
- // Output Value:
- // None
- //
-
- global proc AEbpFormatControls( string $nodeName )
- {
- string $formatAttrName = $nodeName + ".outputPoly";
- string $connections[] = `listConnections $formatAttrName`;
-
- if (size($connections) == 0) {
- // If the output type is not polys,
- // dim all the poly-related controls.
- editorTemplate -dimControl $nodeName "polyOutMethod" true;
- editorTemplate -dimControl $nodeName "polyOutCount" true;
-
- editorTemplate -dimControl $nodeName "polyOutExtrusionType" true;
- editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" true;
- editorTemplate -dimControl $nodeName "polyOutCurveType" true;
- editorTemplate -dimControl $nodeName "polyOutCurveSamples" true;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeight" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
- } else {
- editorTemplate -dimControl $nodeName "polyOutMethod" false;
-
- $formatAttrName = $nodeName + ".polyOutMethod";
- int $value = `getAttr $formatAttrName`;
-
- if ( $value == 0 )
- {
- // face count
- editorTemplate -dimControl $nodeName "polyOutCount" false;
-
- editorTemplate -dimControl $nodeName "polyOutExtrusionType" true;
- editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" true;
- editorTemplate -dimControl $nodeName "polyOutCurveType" true;
- editorTemplate -dimControl $nodeName "polyOutCurveSamples" true;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeight" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
- }
- else
- {
- // sampling
- editorTemplate -dimControl $nodeName "polyOutExtrusionType" false;
- editorTemplate -dimControl $nodeName "polyOutExtrusionSamples" false;
- editorTemplate -dimControl $nodeName "polyOutCurveType" false;
- editorTemplate -dimControl $nodeName "polyOutCurveSamples" false;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeight" false;
- editorTemplate -dimControl $nodeName "polyOutChordHeight" false;
- editorTemplate -dimControl $nodeName "polyOutUseChordHeightRatio" 0;
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" false;
- editorTemplate -dimControl $nodeName "polyOutCount" true;
-
- AEbpUseChordHeightControls( $nodeName );
- AEbpUseChordHeightRatioControls( $nodeName );
- }
- }
- }
-
- global proc AEbpUseChordHeightControls( string $nodeName )
- {
- string $useChordHeightAttrName = $nodeName + ".polyOutUseChordHeight";
- int $useChordHeightValue = `getAttr $useChordHeightAttrName`;
-
- if ( $useChordHeightValue == 0 )
- {
- editorTemplate -dimControl $nodeName "polyOutChordHeight" true;
- }
- else
- {
- editorTemplate -dimControl $nodeName "polyOutChordHeight" false;
- }
- }
-
- global proc AEbpUseChordHeightRatioControls( string $nodeName )
- {
- string $formatAttrName = $nodeName + ".polyOutMethod";
- int $formatValue = `getAttr $formatAttrName`;
- string $useChordHeightRatioAttrName = $nodeName + ".polyOutUseChordHeightRatio";
- int $useChordHeightRatioValue = `getAttr $useChordHeightRatioAttrName`;
-
- if ( $useChordHeightRatioValue == 0 && $formatValue == 2 )
- {
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" true;
- }
- else
- {
- editorTemplate -dimControl $nodeName "polyOutChordHeightRatio" false;
- }
- }
-
- global proc AEbpSideCheckBoxChange(string $bevelCheckBoxGrp, string $attr)
- {
- int $side, $start, $end;
- $start = `checkBoxGrp -query -value1 $bevelCheckBoxGrp`;
- $end = `checkBoxGrp -query -value2 $bevelCheckBoxGrp`;
-
- if ($start && $end) $side = 4;
- else if ($start && !$end) $side = 2;
- else if (!$start && $end) $side = 3;
- else $side = 1;
-
- setAttr $attr $side;
- }
-
- global proc AEbpSideNew( string $attributeUIName, string $attr)
- {
- string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
-
- checkBoxGrp -numberOfCheckBoxes 2
- -label $attributeUIName
- -labelArray2 "At Start" "At End"
- -changeCommand("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
- $bevelCheckBox;
-
- AEbpSideReplace($attributeUIName, $attr);
- }
-
- global proc AEbpSideReplace ( string $attributeUIName, string $attr )
- {
- string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
-
- int $side = `getAttr $attr`;
- int $start, $end;
-
- if (1 == $side) {
- $start = false;
- $end = false;
- } else if (2 == $side) {
- $start = true;
- $end = false;
- } else if (3 == $side) {
- $start = false;
- $end = true;
- } else {
- $start = true;
- $end = true;
- }
-
- checkBoxGrp -edit -valueArray2 $start $end $bevelCheckBox;
- checkBoxGrp -edit -changeCommand
- ("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
- $bevelCheckBox;
- checkBoxGrp -edit -enable true $bevelCheckBox;
- }
-
- global proc AEbpCapSideNew( string $attributeUIName , string $attr )
- {
- string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
-
- checkBoxGrp -numberOfCheckBoxes 2
- -label $attributeUIName
- -labelArray2 "At Start" "At End"
- -changeCommand("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
- $bevelCheckBox;
-
- AEbpCapSideReplace($attributeUIName, $attr);
- }
-
- proc int AEbpCapSideVisible( string $attr )
- //
- // Description:
- // Only allow the cap option in the attribute editor when
- // we have polys. Otherwise, the number of surfaces changes.
- {
- string $opa = `substitute "capSides" $attr "outputPoly"`;
- string $opc[] = `listConnections $opa`;
- int $vis = false;
- if( size($opc) > 0 ) $vis = true;
- return $vis;
- }
-
- global proc AEbpCapSideReplace ( string $attributeUIName, string $attr )
- {
- string $bevelCheckBox = "AEbpCheckBoxGrp" + $attributeUIName;
- int $vis = `AEbpCapSideVisible $attr`;
-
- if( $vis ) {
- int $side = `getAttr $attr`;
- int $start, $end;
-
- if (1 == $side) {
- $start = false;
- $end = false;
- }
- else if (2 == $side) {
- $start = true;
- $end = false;
- }
- else if (3 == $side) {
- $start = false;
- $end = true;
- }
- else {
- $start = true;
- $end = true;
- }
- checkBoxGrp -edit -valueArray2 $start $end $bevelCheckBox;
- checkBoxGrp -edit -changeCommand
- ("AEbpSideCheckBoxChange " + $bevelCheckBox + " " + $attr)
- $bevelCheckBox;
- }
- checkBoxGrp -edit -visible $vis $bevelCheckBox;
- }
-
- global proc AEbevelPlusTemplate( string $nodeName )
- {
- editorTemplate -beginScrollLayout;
-
- editorTemplate -beginLayout "Bevel Plus History" -collapse false;
- editorTemplate -callCustom
- "AEinputNew \"Input Curves\""
- "AEinputReplace \"Input Curves\""
- "inputCurves";
-
- editorTemplate -callCustom
- "AEbpSideNew \"Bevel\""
- "AEbpSideReplace \"Bevel\""
- "numberOfSides";
-
- editorTemplate -label "Bevel Width" -addControl "width";
- editorTemplate -label "Bevel Depth"-addControl "depth";
- editorTemplate -label "Extrude Distance" -addControl "extrudeDepth";
-
- editorTemplate -callCustom
- "AEbpCapSideNew \"Cap\""
- "AEbpCapSideReplace \"Cap\""
- "capSides";
-
- editorTemplate -callCustom
- "AEinputNew \"Outer Style Curve\""
- "AEinputReplace \"Outer Style Curve\""
- "outerStyleCurve";
-
- editorTemplate -callCustom
- "AEinputNew \"Inner Style Curve\""
- "AEinputReplace \"Inner Style Curve\""
- "innerStyleCurve";
-
- editorTemplate -addControl "tolerance";
-
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Polygon Output Options" -collapse true;
- editorTemplate -label "Method" -addControl "polyOutMethod" "AEbpFormatControls";
- editorTemplate -beginLayout "Sampling" -collapse false;
- editorTemplate -label " " -addControl "polyOutExtrusionType";
- editorTemplate -label " " -addControl "polyOutExtrusionSamples";
- editorTemplate -label " " -addControl "polyOutCurveType";
- editorTemplate -label " " -addControl "polyOutCurveSamples";
-
- editorTemplate -label "Use Chord Height" -addControl "polyOutUseChordHeight" "AEbpUseChordHeightControls";
- editorTemplate -label "Chord Height " -addControl "polyOutChordHeight";
- editorTemplate -label "Use Chord Height Ratio" -addControl "polyOutUseChordHeightRatio" "AEbpUseChordHeightRatioControls";
- editorTemplate -label "Chord Height Ratio" -addControl "polyOutChordHeightRatio";
- editorTemplate -endLayout;
-
- editorTemplate -beginLayout "Count" -collapse false;
- editorTemplate -label "Count" -addControl "polyOutCount";
- editorTemplate -endLayout;
-
- editorTemplate -endLayout;
-
- //suppressed attributes
- editorTemplate -suppress "inputCurves";
- editorTemplate -suppress "outerStyleCurve";
- editorTemplate -suppress "innerStyleCurve";
- editorTemplate -suppress "polygonType";
-
- // include/call base class/node attributes
- AEdependNodeTemplate $nodeName;
-
- editorTemplate -addExtraControls;
- editorTemplate -endScrollLayout;
- }
-